package com.disability_federation.mapper;

import com.disability_federation.pojo.WorkingPersonnelList;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 残联工作员列表-数据库接口
 */
@Mapper
public interface MapperWorkingPersonnelList {

    //查询全部员工列表
    //默认更新时间升序排序
    @Select("select * from working_personnel_list.working_personnel_list order by update_time")
    List<WorkingPersonnelList> query();

    //查询全部员工列表
    //更新时间降序排序
    @Select("select * from working_personnel_list.working_personnel_list order by update_time desc")
    List<WorkingPersonnelList> queryDesc();

    //查询全部员工列表
    //姓名升序排序
    @Select("select * from working_personnel_list.working_personnel_list order by name")
    List<WorkingPersonnelList> queryNameAsc();

    //查询全部员工列表
    //姓名降序排序
    @Select("select * from working_personnel_list.working_personnel_list order by name desc")
    List<WorkingPersonnelList> queryNameDesc();

    //查询全部员工列表
    //单位升序排序
    @Select("select * from working_personnel_list.working_personnel_list order by unit")
    List<WorkingPersonnelList> queryUnitAsc();

    //查询全部员工列表
    //单位降序排序
    @Select("select * from working_personnel_list.working_personnel_list order by unit desc")
    List<WorkingPersonnelList> queryUnitDesc();

    //查询全部员工列表
    //注册时间升序排序
    @Select("select * from working_personnel_list.working_personnel_list order by register_time")
    List<WorkingPersonnelList> queryRegisterTimeAsc();

    //查询全部员工列表
    //注册时间降序排序
    @Select("select * from working_personnel_list.working_personnel_list order by register_time desc ")
    List<WorkingPersonnelList> queryRegisterTimeDesc();

    //条件查询员工列表
    //默认更新时间升序排序
    List<WorkingPersonnelList> queryCondition(String name, String unit, Integer gender);

    //条件查询员工列表
    //时间更新降序排序
    List<WorkingPersonnelList> queryConditionDesc(String name, String unit, Integer gender);

    //条件查询员工列表
    //姓名升序排序
    List<WorkingPersonnelList> queryConditionNameAsc(String name, String unit, Integer gender);

    //条件查询员工列表
    //姓名降序排序
    List<WorkingPersonnelList> queryConditionNameDesc(String name, String unit, Integer gender);

    //条件查询员工列表
    //单位升序排序
    List<WorkingPersonnelList> queryConditionUnitAsc(String name, String unit, Integer gender);

    //条件查询员工列表
    //单位降序排序
    List<WorkingPersonnelList> queryConditionUnitDesc(String name, String unit, Integer gender);

    //条件查询员工列表
    //注册时间升序排序
    List<WorkingPersonnelList> queryConditionRegisterTimeAsc(String name, String unit, Integer gender);

    //条件查询员工列表
    //注册时间降序排序
    List<WorkingPersonnelList> queryConditionRegisterTimeDesc(String name, String unit, Integer gender);

    //添加员工
    @Options(useGeneratedKeys = true, keyProperty = "id")//插入成功后，将主键值回填到mybatisUser对象中
    @Insert("insert into working_personnel_list.working_personnel_list(username, password, name, birthday, gender, phone, email, unit, update_time, register_time)"  +
            "value (#{username}, #{password}, #{name}, #{birthday}, #{gender}, #{phone}, #{email}, #{unit}, #{updateTime}, #{registerTime})")
    Integer add(WorkingPersonnelList workingPersonnelList);

    //删除员工
    @Delete("delete from working_personnel_list.working_personnel_list where id=#{id}")
    Integer delete(Integer id);

    //批量删除员工
    Integer deleteBatch(Integer[] ids);

    //更新员工信息
    Integer update(WorkingPersonnelList workingPersonnelList);

    //登录验证
    @Select("select * from working_personnel_list.working_personnel_list where username=#{username} and password=#{password}")
    WorkingPersonnelList login(String username, String password);

    //查询全部残疾员工
    //默认更新时间升序排序
    @Select("select * from working_personnel_list.working_personnel_list where disability=1 order by update_time")
    List<WorkingPersonnelList> queryDisable();

    //查询全部残疾员工
    //更新时间降序排序
    @Select("select * from working_personnel_list.working_personnel_list where disability=1 order by update_time desc")
    List<WorkingPersonnelList> queryDisableDesc();

    //查询全部残疾员工
    //姓名升序排序
    @Select("select * from working_personnel_list.working_personnel_list where disability=1 order by name")
    List<WorkingPersonnelList> queryDisableNameAsc();

    //查询全部残疾员工
    //姓名降序排序
    @Select("select * from working_personnel_list.working_personnel_list where disability=1 order by name desc")
    List<WorkingPersonnelList> queryDisableNameDesc();

    //查询全部残疾员工
    //单位升序排序
    @Select("select * from working_personnel_list.working_personnel_list where disability=1 order by unit")
    List<WorkingPersonnelList> queryDisableRegisterTimeAsc();

    //查询全部残疾员工
    //单位降序排序
    @Select("select * from working_personnel_list.working_personnel_list where disability=1 order by unit desc")
    List<WorkingPersonnelList> queryDisableRegisterTimeDesc();

    //查询全部残疾员工
    //单位升序排序
    @Select("select * from working_personnel_list.working_personnel_list where disability=1 order by unit")
    List<WorkingPersonnelList> queryDisableUnitAsc();

    //查询全部残疾员工
    //单位降序排序
    @Select("select * from working_personnel_list.working_personnel_list where disability=1 order by unit desc")
    List<WorkingPersonnelList> queryDisableUnitDesc();

    //条件查询残疾员工
    //默认更新时间升序排序
    List<WorkingPersonnelList> queryDisableCondition(String name, String unit, Integer gender);

    //条件查询残疾员工
    //时间更新降序排序
    List<WorkingPersonnelList> queryDisableConditionDesc(String name, String unit, Integer gender);

    //条件查询残疾员工
    //姓名升序排序
    List<WorkingPersonnelList> queryDisableConditionNameAsc(String name, String unit, Integer gender);

    //条件查询残疾员工
    //姓名降序排序
    List<WorkingPersonnelList> queryDisableConditionNameDesc(String name, String unit, Integer gender);

    //条件查询残疾员工
    //注册时间升序排序
    List<WorkingPersonnelList> queryDisableConditionRegisterTimeAsc(String name, String unit, Integer gender);

    //条件查询残疾员工
    //注册时间降序排序
    List<WorkingPersonnelList> queryDisableConditionRegisterTimeDesc(String name, String unit, Integer gender);

    //条件查询残疾员工
    //单位升序排序
    List<WorkingPersonnelList> queryDisableConditionUnitAsc(String name, String unit, Integer gender);

    //条件查询残疾员工
    //单位降序排序
    List<WorkingPersonnelList> queryDisableConditionUnitDesc(String name, String unit, Integer gender);
}
